﻿{include file="public/header" /}
<form method="post">
    <div class="panel admin-panel">
        <div class="panel-head"><strong>{:lang('currency')['list']}</strong></div>
        <div class="padding border-bottom">
            <script>
                //city 参数和回调
                var pid = "{:input('get.pid')}";
                var cid = "{:input('get.cid')}";
                var aid = "{:input('get.aid')}";
                var selectc = true;
                var selecta = true;

                function select_p() {
                    return false;
                }

                function select_c() {
                    return false;
                }

                function select_a() {
                    location.href = "{:url('/admin/seller')}?pid=" + pid + "&cid=" + cid + "&aid=" + aid;
                }
            </script>
            <input type="button" class="button button-small checkall" name="checkall" checkfor="id"
                   value="{:lang('currency')['all_select']}"/>
            <a type="button" class="button button-small border-green" href="__URL__/edit.html"/>{:lang('currency')['add']}</a>
            <a id="select_del" type="button" class="button button-small border-red"
               href="#"/>{:lang('currency')['del']}</a>
            {:lang('label')['select']}{:lang('currency')['city']}：{include file="public/city" /}
            <a type="button" class="button button border-yellow search" href="#"/>{:lang('label')['phone']}{:lang('label')['search']}</a>
        </div>
        <table class="table table-hover">
            <tr>
                <th width="35">{:lang('label')['select']}</th>
                <th width="30">ID</th>
                <th width="50">{:lang('label')['headimg']}</th>
                <th width="100">分类</th>
                <th width="120">{:lang('label')['name']}</th>
                <th width="200">{:lang('label')['phone']}</th>
                <th width="100">{:lang('label')['status']}</th>
                <th width="100">{:lang('label')['flag']}</th>
                <!--<th width="100">{:lang('label')['deposit']}</th>-->
                <th width="100">推荐排序值</th>
                <th width="100">{:lang('label')['handle']}</th>
            </tr>
            {volist name="data" id="seller"}
            <tr>
                <td>
                    <input type="checkbox" name="id" value="{$seller.id}"/>
                </td>
                <td style="line-height:40px">{$seller.id}</td>
                <td><img width="40" height="40" src="{$seller.headimg}"/></td>
                <td style="line-height:40px">{$seller.cate}</td>
                <td style="line-height:40px">{$seller.name}</td>
                <td style="line-height:40px">{$seller.phone}</td>
                <td style="line-height:40px">{if $seller.status == "1"}<span class="icon-check text-sub">{:lang('currency')['status_1']}</span>{else}<span
                        class="icon-times text-dot">{:lang('currency')['status_2']}</span>{/if}
                </td>
                <td style="line-height:40px">{if $seller.flag == "1"}<span class="icon-check text-sub">{:lang('currency')['status_1']}</span>{else}<span
                        class="icon-times text-dot">{:lang('currency')['status_2']}</span>{/if}
                </td>
                <td style="line-height:40px;">
                    <input type="number" {if $seller.flag== 0}disabled{/if} value="{$seller.flag_sort}" min="0" onchange="save_sort('{$seller.id}',this.value)" style="background: #f7f7f7;height:30px;padding-left: 5px; width: 50px; border: 1px solid #ccc">
                </td>
                <!--<td style="line-height:40px">{$seller.deposit}</td>-->
                <td style="line-height:40px"><a class="button border-blue button-little" href="__URL__/edit.html?id={$seller.id}">{:lang('currency')['edit']}</a>
                    <a class="button border-red button-little" href="__URL__/del.html?id={$seller.id}&page={:input('get.page')}" onclick="if(confirm('{:lang('currency')['del']}?')){return true;}return false;">{:lang('currency')['del']}</a>
                    <a class="button border-green button-little" href="{:url('service/index')}?uid={$seller.id}&page={:input('get.page')}">查看商品</a>
                    <a class="button border-yellow button-little" href="javascript:money_off('{$seller.id}','{$seller.name}')">满减优惠</a>
                    <a class="button border-yellow button-little" href="javascript:desk('{$seller.id}','{$seller.name}')">桌台管理</a>
                </td>
            </tr>
            {/volist}
        </table>
        {include file="public/pages" /}
    </div>
</form>
<script>
    layer.config({
        extend: 'extend/layer.ext.js'
    });
    $('#select_del').click(function () {
        var str = "";
        $("input:checkbox[name=id]:checked").each(function () {
            str += $(this).val() + ",";
        });
        if (str != '') {
            if (confirm("{:lang('currency')['del']}?"))
            {
                location.href = '__URL__/del.html?id=' + str;
            }
        }
    });
    $('.search').click(function () {
        layer.prompt({title: '{:lang('label')['phone']}{:lang('label')['search']}'}, function (val) {
            location.href = "__ROOT__/admin/seller.html?phone=" + val;
        });
    });

    function save_sort(id, sort) {
        if (confirm('确认修改推荐排序值？')) {
            $.post('__URL__/?edit=flag_sort&id=' + id + '&sort=' + sort, {}, function () {
                layer.msg('修改成功');
            })
        }
    }
    function money_off(uid,name) {
        location = '__URL__/money_off?id='+uid+'&name='+name+'&page={:input("get.page")}';
    }
    function desk(uid,name) {
        location = '__URL__/desk?id='+uid+'&name='+name+'&page={:input("get.page")}';
    }
</script>
{include file="public/footer" /}